﻿using System;
using System.Linq;
using Lyricsgrabber.Core.FLAC;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Lyricsgrabber.Core.Test
{
  [TestClass]
  public class FlacTagTests
  {
    [TestMethod]
    public void TestFlacTag()
    {
      Tag tag = new FlacTag(@".\Resources\FLAC\Only Flac Metadata.flac");

      Assert.IsTrue(tag.Metadata.Any(d => d.Type == MetadataType.Title));
      Assert.AreEqual("My Queen Of Winter", tag.Metadata.First(d => d.Type == MetadataType.Title).Value);

      Assert.IsTrue(tag.Metadata.Any(d => d.Type == MetadataType.Album));
      Assert.AreEqual("Gather The Faithful", tag.Metadata.First(d => d.Type == MetadataType.Album).Value);

      Assert.IsTrue(tag.Metadata.Any(d => d.Type == MetadataType.Artist));
      Assert.AreEqual("Cain's Offering", tag.Metadata.First(d => d.Type == MetadataType.Artist).Value);

      IMetadata lyrics = tag.Metadata.FirstOrDefault(d => d.Type == MetadataType.SyncedLyrics);

      Assert.IsNotNull(lyrics);
      Assert.AreEqual(@"When the darkness has grown strong,
And the nights they feel so long.
Like the sun has slept too long just waiting winter's waning.

Blow out the candle and unleash the night,
Open the door, let the cold inside.
My heart you have captured, don't shatter my rapture
Don't leave all my dreams to decay.
[Chorus:]
All of my life I've been waiting for someone,
To share all my kingdom with me.
The silence unbroken, words left unspoken,
Sign across my heart your name.
The Queen of Winter; this is where you reign!

You are the daughter of the wolves and the breeze,
I am the beast of the winter.
Chill in your spine and the howl in the night,
I have the frost in your heart.

Get up! Get up!
Get up! Get up!
You're never gonna give up!

How would you feel,
If you can't hurt me.
How would you feel,
Going without pain?
[Chorus]
[Solo]

Sleep can be eternal,
Underneath the veil of stars,
The caress of a person,
Can be so soothing on our scars.

Stay forever, here beside me.
Slumber peacefully.
Through the years, my heart will belong to you,
And you belong to me.
[Chorus]

Where you reign!", lyrics.Value);
    }
  }
}
